Conversation
Update fork
Playing with AST checks can be very tedious because of the amount of "incorrect" Python code which raises E901 (or fail differently) when AST checks are enabled. An easy solution is to fix the code but this is not always applicable. I've only performed the abundant and trivial changes.
|
|
||
| Okay: def complex(real, imag=0.0): | ||
| Okay: return magic(r=real, i=imag) | ||
| Okay: def complex(real, imag=0.0):\n return magic(r=real, i=imag) |
There was a problem hiding this comment.
These were two separate checks for two separate test cases. Collapsing them may introduce bugs
There was a problem hiding this comment.
The whole thing is still tested, isn't it ? Or I can write:
def complex(real, imag=0.0): pass
and
magic(r=real, i=imag)
There was a problem hiding this comment.
I would rather retain two separate tests cases.
There was a problem hiding this comment.
I am suggesting 2 separate test cases, each of them corresponding to a piece of valid Python code.
| #: E111 | ||
| if x > 2: | ||
| print x | ||
| print(x) |
There was a problem hiding this comment.
This means we'll loose coverage for the print statement then, yes?
There was a problem hiding this comment.
I am not sure I fully understand what you mean. The E11 errors does not seem to be related to print and/or parentheses in any way.
| @@ -1,22 +1,22 @@ | |||
| #: E121 | |||
| print "E121", ( | |||
There was a problem hiding this comment.
If parentheses are important for these tests (which is likely), maybe I could replace the
print expression
with
raise expression
or
assert expression
Playing with AST checks can be very tedious
because of the amount of "incorrect" Python
code which raises E901 (or fail differently)
when AST checks are enabled.
An easy solution is to fix the code but this
is not always applicable.
I've only performed the trivial changes.